;; Comprehensive test for set! special form - all working cases
(display "=== Comprehensive set! Test ===\n\n")

;; Test 1: Basic set!
(display "Test 1: Basic set!\n")
(define x 10)
(display "x before: ")
(display x)
(display "\n")
(set! x 20)
(display "x after set!: ")
(display x)
(display "\n\n")

;; Test 2: Set! with expression
(display "Test 2: Set! with expression\n")
(define y 5)
(display "y before: ")
(display y)
(display "\n")
(set! y (+ y 10))
(display "y after set! (+ y 10): ")
(display y)
(display "\n\n")

;; Test 3: Function with set! using explicit lambda syntax
(display "Test 3: Function with set! using lambda syntax\n")
(define counter 0)
(display "counter before: ")
(display counter)
(display "\n")
(define increment (lambda () (set! counter (+ counter 1)) counter))
(display "(increment) = ")
(display (increment))
(display "\n")
(display "counter after increment: ")
(display counter)
(display "\n\n")

;; Test 4: Modifying a function definition with set!
(display "Test 4: Modifying a function with set!\n")
(define greet (lambda (name) (string-append "Hello, " name)))
(display "(greet \"World\") = ")
(display (greet "World"))
(display "\n")
(set! greet (lambda (name) (string-append "Hi there, " name)))
(display "After set!: (greet \"World\") = ")
(display (greet "World"))
(display "\n\n")

;; Note: The shorthand function definition syntax with set! in body is not working
(display "=== Tests Complete ===\n")
(display "Note: For functions containing set!, use explicit lambda syntax.\n")